function readmkdir(fpath,path) {
    var fs = require("fs");
    let map = new Map()
    let filepath = fpath
    readk(filepath)

    function readk(filepath) {
        // console.log(`查看 ${filepath} 目录`);
        let files = fs.readdirSync(filepath)
        files.forEach(function (file) {
            // readFile(filepath+file)
            let stats= fs.statSync(filepath + file)
            if (stats.isDirectory()) {
                readk(filepath + file + "/")
            } else if (stats.isFile()) {
                console.log("开始读取", filepath + file);
                readFile(filepath + file)
            }
        })
    }

    function readFile(fileName) {
        var data = fs.readFileSync(fileName);
        let newpath = fileName.replace(filepath, "")
        if(/[\.png,\.gif,\.jpg]$/)
        map.set(path+newpath, data)
        else
        map.set(path+newpath, data.toString())
    }
    return map
}
module.exports = readmkdir;